package org.linuxsogood.boot.controller;

import org.linuxsogood.boot.pojo.Blog;
import org.linuxsogood.boot.service.BlogService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author honway.liu
 * @date 2018/8/5 下午9:19
 * @email gm100861@gmail.com
 * @blog http://linuxsogood.org
 */
@RestController
@RequestMapping("/api")
public class BlogController {

    private final BlogService blogService;

    public BlogController(BlogService blogService) {
        this.blogService = blogService;
    }

    @RequestMapping("/blog/{id}")
    public Blog queryBlog(@PathVariable("id") Integer id) {
        return blogService.selectBlogByPrimiary(id);
    }

    @RequestMapping("/blog/ok")
    public String ok() {
        return "ok";
    }
    @RequestMapping("/blog/test")
    public Object test() {
        return null;
    }
}
